/**
 * Created by WangMing on 15/12/9.
 */
define(["avalon",'text!./sliderWidget.html'], function (avalon,sourceHTML) {
  // console.log(sourceHTML);
  // 定义widget
  var widget = avalon.ui.sliderWidget = function(element, data, vmodels){
  	var vmodel = avalon.define(data.sliderWidgetId, function(vm){

  		avalon.mix(vm, data.sliderWidgetOptions);
  		// className  height hasDot sliders





  		vm.$init = function(){

			    element.innerHTML = sourceHTML;

        	avalon.scan(element, [vmodel].concat(vmodels));

          if(vm.className != "slider-banner" ){
            vm.descVisiable = false
          }


	      	jQuery("."+vm.className.split(" ")[0]).voyeur({
	            rect: {
	                width: vm.width ,
	                height: vm.height 
	            },
              hasAlbum: false

	        })

  		}

  		vm.$remove = function(){
  			element.innerHtml = element.textContent = "";
  		}
  	})
    return vmodel;
  }
  widget.defaults = {
    width:960,
    height:450,
  	className : "slider-banner",
    descVisiable:true
  }

  return avalon;
});

